<?php 
/**
 * 大道CMS 在线留言
 * @author   tongjh
 * @version  V1.0
 */
class LiuyanAction extends CommonAction {	
	
   /**
     * 留言列表
     * @access public
     * @return void
     */
    public function index(){
        $Form = M('liuyan');
        import("@.ORG.Util.Page");
        $count = $Form->count();
	$p = new Page($count, 10);
        $list = $Form->limit($p->firstRow . ',' . $p->listRows)->order('id desc')->select();	
        $page = $p->show();
        $this->assign("page", $page);
        $this->assign("list", $list);
        $this->display();	
    }

  
    /**
     * 留言修改
     * @access public
     * @return void
     */
    public function edit($id){
        $m = M('liuyan');
        if(IS_POST){
            if(false === $m->create()){$this->error('审核失败');}
            if(false === $m->save()){$this->error('审核失败');}
            $this->success('审核成功');exit();
        }        
        $list = $m->find($id);
        $this->assign('list',$list);
        $this->display();    	
   }

   

	/*
	* 用户删除
	* @return string
	*/
   public function del($id){
        $m = M('liuyan');
        if(false === $m->delete($id)){
            $this->error('删除失败');
        }
        $this->success('删除成功');
   }

   

}
?>